A positional language defines the meaning of text by its character position within a line. For example, for the iSeries class of mid range servers offered by International Business Machines Corp. of Armonk, N.Y., an illustrative positional language is the Report Program Generator (RPG). Applications written in RPG read and write data from and to databases and devices such as displays and printers. The interface to these databases and devices is described by a series of lines that is called Data Description Specifications (DDS) which is another illustrative positional language.
In general, positional languages comprise some of the earliest programming languages. More recently, token-based languages (e.g., Java, C++, etc.) have increased in popularity. In either case, the source code is traditionally modified using a text editor. However, Integrated Development Environments (IDEs) for various programming languages have been enhanced to provide the user with a more productive, intuitive development environment. These enhancements rely on the generation of a document object model (DOM) that corresponds to the source code. In particular, a parser for a compiler included in the IDE can be used to translate source code in a particular programming language into the DOM. The DOM comprises a representation of the source code that captures all of the semantic information included in the source code. When compiling, the DOM is used to generate the program product.
The IDE uses the DOM to provide various enhancements to the user. For example, the DOM can be used to generate one or more graphical views that enable the user to visualize aspects of the language. To this extent, the IDE can display an outline of a program product being developed, an accurate representation of a screen and/or report being developed, etc. Further, the IDE can provide one or more visual editors that are more user-friendly, such as a properties view, a graphical editor, or the like. In this case, it is desirable to allow the user to readily switch between the source code editor and the visual editor.
The visual editors modify data in the DOM. As a result, the IDE must maintain synchronization between the source code and the DOM. To date, an incremental compiler is typically used. In particular, the incremental compiler re-parses modified source code and updates the DOM and/or regenerates affected source code after the DOM is modified. Typically, a token-based parsing of the source code is performed and the result is merged with the existing DOM. Since this operation can be complex, there may be performance problems, such as a user-perceptible delay between modifying the DOM/source code and seeing the change reflected in the corresponding source code/DOM. Further, the incremental compiler can be error-prone and expensive to maintain.
However, for a positional language, synchronization between the DOM and source code can be more efficiently maintained. To this extent, a need exists for an improved solution for maintaining synchronization between source code written in a positional language and a DOM that uses the character position of data in the source code to simplify the synchronization process.